﻿using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Results;
using Web.Models;

namespace Web.Controllers
{
    [RoutePrefix("api/default")]
    public class DefaultApiController : ApiController
    {
        /// <summary>
        /// 加密传输数据示例接口
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPut]
        [Route("save")]
        public async Task<HttpResponseMessage> Save()
        {
            //反序列化成对象，拿到请求的参数
            var model = await Request.GetAsync<SaveModel>();

            //TODO，一些业务逻辑
            model.UpdateTime = DateTime.Now;

            //序列化成对象，输出给客户端
            return Request.Respond(model);
        }
    }
}
